package com.zhaungjie.base.utils;

import java.util.Random;

/**
 * 默认密码生成器
 *
 * @author zhuangjie
 * @date 2023/10/02
 */
public class PasswordGenerator {
    public static final String chars = "abcdefghijklmnopqrstuvwxyz0123456789";

    public static String generate(int length) {
        Random random = new Random();
        StringBuilder password = new StringBuilder();
        for (int i = 0; i < length; i++) {
            char randomChar = chars.charAt(random.nextInt(chars.length()));
            password.append(randomChar);
        }
        return password.toString();
    }
}